
package fmu.pi.view.handler;

import fmu.pi.business.MovimentacaoBusiness_OLD;
import fmu.pi.model.bean.*;
import java.util.Date;
import java.util.List;


public class HandlerView
{
   private Usuario usuario; 
    private List<Grupo> groupList; 
    private List<Conta> accountList; 
    private List<Cartao> cardList; 
    private List<Movimentacao> movList; 
    private Float saldo; 
    private Float saldos; 
    private MovimentacaoBusiness_OLD bus;  
    
    public HandlerView()
    {
       initLists(); 
    }
    
    private void initLists()
    {
        
        bus = new MovimentacaoBusiness_OLD();
        usuario = bus.getUsuario(); 
        groupList = bus.grupos(); 
        accountList = bus.contas(); 
        cardList = bus.cards();
        saldo = bus.getSaldo(); 
    }
    
    public <T extends Entidade> Integer updateTables(T entidade, String operation)
    {
        Integer result = 0; 
        result = bus.updateTables(entidade, operation);  
        
        return result; 
    }
    
    public void geraExtrato(Date first, Date last)
    {
       bus.geraExtrato(first, last); 
       movList = bus.getMovList(); 
    }
    
    public Usuario getUsuario()
    {
        return usuario; 
    }
    
    public List<Grupo> getGroupList()
    {
        return groupList; 
    }
    
    public List<Conta> getAccountList()
    {
        return accountList; 
    }
    
    public List<Cartao> getCardList()
    {
        return cardList; 
    }
    
    public List<Movimentacao> getMovList()
    {
        return movList; 
    }
    
    public Float getSaldo()
    {
        return saldo; 
    }
    
    public Float getSaldo(String year)
    {
        return bus.geraSaldo(year); 
    } 
}
